package leetcode.weekly.week324;

import java.util.HashMap;
import java.util.Map;

//Solution1Test
public class Solution1 {
	public int similarPairs(String[] words) {
		Map<Integer, Integer> map = new HashMap<>();
		int ans = 0;
		for (String s : words) {
			int cur = 0;
			for (char c : s.toCharArray()) {
				cur |= 1 << c - 'a';
			}
			ans += map.getOrDefault(cur, 0);
			map.put(cur, map.getOrDefault(cur, 0) + 1);
		}
		return ans;
	}

}
